﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tenebrous_Manor
{
    static public class Dialogue
    {
        public enum Dialogue_keys
        {
            #region general
            NOTHING,
            DOOR,
            LOCKED_DOOR,
            #endregion

            #region Main Entrance Cutscene
            INTRO_DIALOGUE,
            DARK_DIALOGUE,
            ENTRANCE_DIALOGUE,
            #endregion

            #region main entrance
            SAFE_FEELING,
            ENTRANCE_DOOR,
            DESK,
            DESK_WITH_BOOK,
            #endregion

            #region foyer
            STAIRS_UP,
            #endregion

            #region kitchen
            FRIDGE,
            STOVE,
            SINK,
            COUNTER,
            TABLE,
            KITCHEN_LEVER,
            #endregion

            #region junk room
            SCREWDRIVER,
            BUNCH_OF_JUNK,
            #endregion

            #region study
            STUDY_DOOR,
            BOOKS,
            NOTE,
            STUDY_DESK,
            TRAP_DOOR,
            #endregion

            #region upper landing
            BROKEN_DOOR,
            MISSING_DOORKNOB,
            HOLES,
            STAIR_DOWN,
            #endregion

            #region bedroom
            STUDY_KEY,
            BED,
            CUPBOARD,
            #endregion

            #region basement
            BOX,
            BIG_HOLE,
            LAB_DOOR,
            #endregion

            #region research lab
            MACHINE,
            FUSE,
            BREAKER,
            #endregion

            #region research notes
            FOUND_NOTE,
            RESEARCH_NOTE1,
            RESEARCH_NOTE2,
            RESEARCH_NOTE3,
            RESEARCH_NOTE4,
            RESEARCH_NOTE5,
            RESEARCH_NOTE6,
            #endregion

            #region End Cutscene
            SEE_SHADES,
            SCREAM1,
            SCREAM2,
            END1,
            END2
            #endregion

        }

        static public Dictionary<Dialogue_keys, string> dialogue = new Dictionary<Dialogue_keys, string>();

        static public void Initialize()
        {
            dialogue.Clear();

            #region general
            dialogue.Add(Dialogue_keys.NOTHING, "Nothing interesting here...");
            dialogue.Add(Dialogue_keys.DOOR, "It's not locked, I can go to the next room.");
            dialogue.Add(Dialogue_keys.LOCKED_DOOR, "Hmm... I can't open it.");
            #endregion

            #region Main Entrance Cutscene
            dialogue.Add(Dialogue_keys.INTRO_DIALOGUE, "My name is Gary Rogers. I\'ve received many request to investigate paranormal activty in \"Tenebrous Manor\", the manor on top of this hill. And now I have arrived");
            dialogue.Add(Dialogue_keys.DARK_DIALOGUE, "Wow... It sure is dark in here... I can't see anything. Good thing I brought my flashlight.");
            dialogue.Add(Dialogue_keys.ENTRANCE_DIALOGUE, "So... Another report of \"supernatural\" activity... I wonder what it is this time. Kids? Wild animals? Squatters? Government test facility? The last one would be a great story, but what are the odds? Only way to find out though.");
            #endregion

            #region main entrance
            dialogue.Add(Dialogue_keys.SAFE_FEELING, "I feel oddly safe in this room.");
            dialogue.Add(Dialogue_keys.ENTRANCE_DOOR, "It leads outside. But I haven't found anything yet, so I'm not leaving.");
            dialogue.Add(Dialogue_keys.DESK, "It's a desk.");
            dialogue.Add(Dialogue_keys.DESK_WITH_BOOK, "Oh, this is one of those guestbooks.");
            #endregion

            #region foyer
            dialogue.Add(Dialogue_keys.STAIRS_UP, "A staircase leading upstairs.");
            #endregion

            #region kitchen
            dialogue.Add(Dialogue_keys.FRIDGE, "Of course, it's empty. Only some number magnets on the door.");
            dialogue.Add(Dialogue_keys.STOVE, "It's surprisingly clean.");
            dialogue.Add(Dialogue_keys.SINK, "Nothing in the sink.");
            dialogue.Add(Dialogue_keys.COUNTER, "Just a little dust. Nothing else.");
            dialogue.Add(Dialogue_keys.TABLE, "Nothing on the table here...");
            dialogue.Add(Dialogue_keys.KITCHEN_LEVER, "Hmm...");
            #endregion

            #region junk room
            dialogue.Add(Dialogue_keys.SCREWDRIVER, "A piece of paper, an empty box, junk, more junk, a screwdriver...");
            dialogue.Add(Dialogue_keys.BUNCH_OF_JUNK, "So much useless garbage");
            #endregion

            #region study
            dialogue.Add(Dialogue_keys.STUDY_DOOR, "Darn, it's locked. Wonder where's the key");
            dialogue.Add(Dialogue_keys.BOOKS, "Hmm...A lot of books here. Wonder if there is anything useful");
            dialogue.Add(Dialogue_keys.NOTE, "Huh? What's this paper... \"Pull down... Kitchen.\" Darn, the writing is smugde, that's all I can read.");
            dialogue.Add(Dialogue_keys.STUDY_DESK, "Nothing on the desk.");
            dialogue.Add(Dialogue_keys.TRAP_DOOR, "It's a trap door... wonder where it leads.");
            #endregion

            #region upper landing
            dialogue.Add(Dialogue_keys.BROKEN_DOOR, "Wow... this door has been smashed to pieces...");
            dialogue.Add(Dialogue_keys.MISSING_DOORKNOB, "Damn, it's missing the doorknob. I can't go through.");
            dialogue.Add(Dialogue_keys.HOLES, "Yikes... look at those holes!");
            dialogue.Add(Dialogue_keys.STAIR_DOWN, "A staircase leading downstairs.");
            #endregion

            #region bedroom
            dialogue.Add(Dialogue_keys.STUDY_KEY, "A key? I wonder what this opens...");
            dialogue.Add(Dialogue_keys.BED, "No time to rest now.");
            dialogue.Add(Dialogue_keys.CUPBOARD, "Empty...");
            #endregion

            #region basement
            dialogue.Add(Dialogue_keys.BOX, "I wonder what's in these boxes... can't reach the top to open them though");
            dialogue.Add(Dialogue_keys.BIG_HOLE, "...why is there a hole in the basement... I can't even see the bottom");
            dialogue.Add(Dialogue_keys.LAB_DOOR, "It's locked... there seems to be a number lock on it. I should try to find a combination to open it");
            #endregion

            #region research lab
            dialogue.Add(Dialogue_keys.MACHINE, "...some sort of machine. No idea how it works. There is no power to run it either.");
            dialogue.Add(Dialogue_keys.FUSE, "Hmm... seems the be a fuse on the ground");
            dialogue.Add(Dialogue_keys.BREAKER, "A breaker! It seems like it's missing a fuse... If I can find one, maybe I can get some light in this building. Maybe one of the machines has a fuse I could use.");
            #endregion

            #region research notes
            dialogue.Add(Dialogue_keys.FOUND_NOTE, "What's this... a note? The information seems interesting. I should go to the Main Entrance to read this");

            dialogue.Add(Dialogue_keys.RESEARCH_NOTE1,
                "-October 31, 2010-\n"
                + "Dimensional Analysis has found an adjacent dimension with properties that are shared with our own. "
                + "Further analysis must be done before a probe can be sent through to investigate."
                );

            dialogue.Add(Dialogue_keys.RESEARCH_NOTE2,
                "-November 29, 2010-\n"
                + "An error occured after sending in the probe. "
                + "We miscalculated and have accidently created a minor tear in the dimensional barrier. "
                + "Although no ill side effects have occurred as of yet, we need to quickly seal off the rift."
                );

            dialogue.Add(Dialogue_keys.RESEARCH_NOTE3,
                "-December 1, 2010-\n"
                + "An extradimensional entity came through the rift! "
                + "It looks humanoid, but seems to be made of tangible shadow. "
                + "The umbral creature appears non-hostile and seems to be studying us, as we are doing the same to him."
                );

            dialogue.Add(Dialogue_keys.RESEARCH_NOTE4,
                "-December 3, 2010-\n"
                + "Extraordinary! The umbral creature has morphic traits. "
                + "It can become partially and completely tranlucent at will. "
                + "We have been able to temporarily seal off the dimensional rift. "
                + "The entity seems undisturbed by the closure."
                );

            dialogue.Add(Dialogue_keys.RESEARCH_NOTE5,
                "-December 10, 2010-\n"
                + "The entity has started to look like Dr.Ryan, who has been the one leading the research on the umbral creature itself. "
                + "We have reached the conclusion that the entity is trying to show its interest by trying to imitate the good doctor."
                );

            dialogue.Add(Dialogue_keys.RESEARCH_NOTE6,
                "-December 12, 2010-\n"
                + "We were greatly mistaken. "
                + "The entity was studying us, but it is far from benign. "
                + "The umbral creature finished its complete transformation into Dr.Ryan and then... "
                + "did something to him, before destroying our temporary seal from the dimensional rift. "
                + "It seems many of these umbral creatures have been waiting for this as they began to pour into our dimension and capture us. "
                + "I fear what they plan as we wait for their complete transformations, which is progressing at a higher rate than that of Dr.Ryan's doppelganger. "
                + "I hope that someone finds out about this research and stop the shadows. "
                + "Our research should be able to create a device to locate these fakes. "
                + "I fear my time is approaching. "
                + "May God have mercy on our souls..."
                );
            #endregion

            #region End Cutscene
            dialogue.Add(Dialogue_keys.SEE_SHADES, "...This is bad.... GET AWAY!");
            dialogue.Add(Dialogue_keys.SCREAM1, "DON'T COME ANY CLOSER!");
            dialogue.Add(Dialogue_keys.SCREAM2, "AHHHHHH!");
            dialogue.Add(Dialogue_keys.END1, "It must have been a prank by some kids, I guess. I couldn't find anything.");
            dialogue.Add(Dialogue_keys.END2, "Isn't that right... Gary?");
            #endregion
        }

        static public void Update(){
            if(GameBools.getGameBool(GameBools.GameBool.SEEN_MISSING_KNOB))
            {
                dialogue[Dialogue_keys.BROKEN_DOOR] = "Oh great! I can use this doorknob! *obtained doorknob*";
                dialogue[Dialogue_keys.SCREWDRIVER] = "Hey! This screwdriver should be useful *obtained screwdriver*";
            }

            if(GameBools.getGameBool(GameBools.GameBool.DOORKNOB))
            {
                dialogue[Dialogue_keys.BROKEN_DOOR] = "I got what I need from this door";

                if (!GameBools.getGameBool(GameBools.GameBool.SCREWDRIVER))
                    dialogue[Dialogue_keys.MISSING_DOORKNOB] = "Hmm... let see if this doorknob works... Damn, I need to find a screwdriver.";
                else
                {
                    dialogue[Dialogue_keys.SCREWDRIVER] = dialogue[Dialogue_keys.BUNCH_OF_JUNK];
                    dialogue[Dialogue_keys.MISSING_DOORKNOB] = "Let me put this doorknob in... and now to screw it...YES! It worked!";
                }
            }

            if(GameBools.getGameBool(GameBools.GameBool.BEDROOM))
                dialogue[Dialogue_keys.MISSING_DOORKNOB] = dialogue[Dialogue_keys.DOOR];

            if (GameBools.getGameBool(GameBools.GameBool.STUDY_KEY))
            {
                dialogue[Dialogue_keys.STUDY_KEY] = "I found the key here. I wonder what it unlocks";
                dialogue[Dialogue_keys.STUDY_DOOR] = "I wonder if the key I found will work... Yes! It opened!";
            }

            if (GameBools.getGameBool(GameBools.GameBool.STUDY_NOTE))
                dialogue[Dialogue_keys.KITCHEN_LEVER] = "Hmm... Maybe this lever is what the note was referring to. Let me try pulling it... Huh? There was a noise coming from somewhere on this floor";

            if (GameBools.getGameBool(GameBools.GameBool.LEVER_PULLED))
            {
                dialogue[Dialogue_keys.KITCHEN_LEVER] = "There was a noise in another room when I pulled this lever";
                dialogue[Dialogue_keys.STUDY_DESK] = "Where did that noise come from...? Hmmm...? There's something under the desk!";
            }

            if (GameBools.getGameBool(GameBools.GameBool.DESK_MOVED))
                dialogue[Dialogue_keys.STUDY_DESK] = "Who would have thought there would be a door under this desk";

            if (GameBools.getGameBool(GameBools.GameBool.SEEN_NUM_LOCK))
            {
                dialogue[Dialogue_keys.FRIDGE] = "Wait... the number magnets on the fridge... could this be the combination? 27953.";
                dialogue[Dialogue_keys.LAB_DOOR] = "I need to find a number combination to open this door";
            }

            if (GameBools.getGameBool(GameBools.GameBool.HAVE_COMBINATION))
            {
                dialogue[Dialogue_keys.FRIDGE] = "I should try this combination on the door in the basement";
                dialogue[Dialogue_keys.LAB_DOOR] = "Let me just enter the numbers... 27953... Yes! It unlocked!";
            }

            if (GameBools.getGameBool(GameBools.GameBool.RESEARCH_LAB))
            {
                dialogue[Dialogue_keys.FRIDGE] = "The fridge is empty. ";
                dialogue[Dialogue_keys.LAB_DOOR] = dialogue[Dialogue_keys.DOOR];
            }

            if (GameBools.getGameBool(GameBools.GameBool.BREAKER))
            {
                dialogue[Dialogue_keys.FUSE] = "A fuse... maybe it'll fit in the breaker!";
                dialogue[Dialogue_keys.BREAKER] = "I should check those machines for a fuse.";
            }

            if (GameBools.getGameBool(GameBools.GameBool.FUSE))
            {
                dialogue[Dialogue_keys.FUSE] = dialogue[Dialogue_keys.MACHINE];
                dialogue[Dialogue_keys.BREAKER] = "I wonder if this will work...YES!";
            }
        }
    }
}
